package com.hrt.datasender.datadao.service;

import java.util.List;

import com.btcode.orm.model.ModelPageResult;
import com.hrt.datasender.datadao.model.BcAccessParamModel;
import com.hrt.db.DBManager;

/**
 * 
 * <pre>
 * 注释
 * </pre>
 * 
 * @author FAN
 * @date 2018年9月12日下午5:22:27
 */
public final class BcAccessParamService {

    private static volatile BcAccessParamService instance;

    private BcAccessParamService() {

    }

    public static BcAccessParamService getInstance() {
        if (instance == null) {
            synchronized (BcAccessParamService.class) {
                if (instance == null) {
                    instance = new BcAccessParamService();
                }
            }
        }
        return instance;
    }

    public void create(BcAccessParamModel model) {
        DBManager.getORMExecuter().create(model);
    }

    public void update(BcAccessParamModel model) {
        DBManager.getORMExecuter().update(model);
    }

    public void delete(String id) {
        BcAccessParamModel model = new BcAccessParamModel();
        model.setId(id);
        DBManager.getORMExecuter().delete(model);
    }

    public List<BcAccessParamModel> getList() {
        ModelPageResult mpr = DBManager.getORMExecuter().getModelList(BcAccessParamModel.class, null,null);
        List<BcAccessParamModel> models = mpr.getData();
        return models;
    }
}
